<script>on mouseUpget the heapSpaceput it into line 1 of card field id 6listDialog card field "test", "Please select a card:", ¬the rect of card window,300,100,0,12get the resultput it into selectedif selected is empty thenput "ListDialog XCMD returns:" && quote & "empty" & quote into msganswer "ListDialog XCMD returns: " & selectedelseput "ListDialog XCMD returns:" && quote & selected & quote into msganswer "ListDialog XCMD returns: " & selectedend if-- play boing c, cget the heapSpaceput it into line 2 of card field id 6visual effect dissolvego card selectedend mouseUp</script>
</part>
<part>
<id>2</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>4</left>
<top>106</top>
<right>108</right>
<bottom>340</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<textHeight>13</textHeight>
<name>test</name>
<script></script>
</part>
<part>
<id>3</id>
<type>button</type>
<visible> <false /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>5</left>
<top>79</top>
<right>105</right>
<bottom>101</bottom>
</rect>
<style>roundrect</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Put name</name>
<script>on mouseUpput "first" & return into card field 1put "second" & return after card field 1put "third" & return after card field 1put "forth" & return after card field 1put "fifth" & return after card field 1repeat with i = 1 to 150set cursor to busyput "Hypercard" & i & return after card field 1end repeatend mouseUp</script>
</part>
<part>
<id>5</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>114</left>
<top>107</top>
<right>509</right>
<bottom>340</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<textHeight>13</textHeight>
<name></name>
<script></script>
</part>
<part>
<id>6</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>433</left>
<top>26</top>
<right>484</right>
<bottom>55</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name></name>
<script></script>
</part>
<part>
<id>7</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>5</left>
<top>4</top>
<right>81</right>
<bottom>55</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>14767</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>About</name>
<script>on mouseUpset visible of card field "About" to not ¬(the visible of card field "About")end mouseUp</script>
</part>
<part>
<id>8</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>3</left>
<top>104</top>
<right>509</right>
<bottom>340</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>About</name>
<script>on mouseUphide meend mouseUp</script>
</part>
<content>
<layer>card</layer>
<id>5</id>
<text><span class="style1">istDialog is an XCMD which has the following syntax:</span><span class="style2">ListDialog <source> ,prompt ,the rect of card window, left, top, font ID, font size</span><span class="style1">such as:</span><span class="style2"></span><span class="style1">ListDialog card field 1, "Please enter:", the rect of card window, 70, 100, ¬0, 12</span><span class="style2">IT IS REQUIRED THAT YOU USE ALL 7 PARAMTER.</span><span class="style1"></span><span class="style2">Source</span><span class="style1"> can be any container including variable and field. If you use string literal as the first paramter, you have to use double quote. The delimiter must be returns and the last line of the data should also includes a return (can not take end-of-line).</span><span class="style2">Prompt</span><span class="style1"> is the prompt string that appears at the top of the dialog. If prompt is not a container, it must be double-quoted. Prompt is optional.</span><span class="style2">the rect of card window</span><span class="style1"> is only applied when you want to specify the location of the dialog window. You have to type those words as a paramter without quote since ListDialog XCMD needs Hypercard to evaluate the expression and pass the actual coordinant of the card window as a paramter.</span><span class="style2">left, top</span><span class="style1"> to specify where you want your dialog box, in pixels, relative to the card window. left is horizontal and top is vertical.</span><span class="style2">font ID, font size</span><span class="style1"> to specify the font and its size which to be shown in the dialog list. Note that both of them are integers. Default font ID is 0 and font size is 12, which is Chicago 12 points. You can check your Hypercard reference to find the font ID you want, or you can use ResEdit to see the "FOND" resource in order to learn the font ID you want.</span><span class="style2">NOTE:</span><span class="style1"> This XCMD takes the ID number from the resource "FOND", not the resource "FONT".</span><span class="style2">Example script 1:</span><span class="style1">on mouseUp listDialog card field "cards", "Please select a card:" get the result if it is not empty then visual effect dissolve go card it end ifend mouseUp</span><span class="style2">Example script 2: </span><span class="style1">dialog box appears at (10, 20) from upper left cornor of the card window and uses Times 12 points.on mouseUp listDialog card field "cards", "Please select a card:", ¬ the rect of card window, 10, 20, 20, 12 get the result if it is not empty then visual effect dissolve go card it end ifend mouseUp</span><span class="style2">Installation:</span><span class="style1">Use any resource editor such as ResEdit or ResCopy to copy the following 3 resources into your stack:XCMD id 2000, DLOG id 400, and DITL id 400</span><span class="style2">Number of paramters:</span><span class="style1">You can pass either </span><span class="style2">1, 2, 3, 5, or 7 paramters</span><span class="style1"> to ListDialog XCMD. However, it is suggested that you use all 5 paramters.If you only pass </span><span class="style2">1 paramter</span><span class="style1">, it should be the source.ex. ListDialog card field 1In this case, there is no prompt string and the dialog will be positioned at the default position (upper left from the screen).If you pass </span><span class="style2">2 paramters</span><span class="style1">, they should be the source and prompt.ex. ListDialog card field 1, "Please choose one:"The dialog box will appear at the default position.If you pass </span><span class="style2">3 paramters</span><span class="style1">, they should be the source, prompt and the rect of card window.ex. ListDialog card field 1, "Please choose one:",the rect of card windowThe dialog will position at the upper left corner of card window.If you pass</span><span class="style2"> 5 paramters</span><span class="style1">, they should be the source, prompt and the rect of card window, and the location of the dialog.ex. ListDialog card field 1, "Please choose one:",the rect of card window, 30, 50The upper left corner of the dialog will appear at 30 pixels from the right and 50 pixels from the top of the card window.If you pass </span><span class="style2">7 paramters</span><span class="style1">, you are in perfect shape. </span><span class="style2">Specification:</span><span class="style1">1. Use up/down arrow key to scroll up/down.2. Hit return/enter key is the same as clicking on "OK".3. Double click on an item to select it and close the dialog box.4. Click on "Cancel" will return empty. 5. The "esc" key is the same as hitting "Cancel" button.6. If listDialog goes well, it will return your selection as you click on "OK" button.7. There is a Hot-key function. While the dialog appears, you can type in any character (0-9 and a-z, case insensitive) to select the first line whose first character is the same as the one you typed.8. The DLOG resource id is "400", if ListDialog can not find the DLOG resource, it exits and return an error message.9. If the number of paramters is not correct listDialog exits and return an error message.10. If listDialog is unable to return selection ,it sends "No selection".11. You can change the size of the dialog with ResEdit and open the DLOG resource id 400.</span><span class="style2">Dialog resource editing (changeing dialog size):</span><span class="style1">1. Use ResEdit or other resource editor to open the DLOG resource id 400 from this stack (or the stack that you install ListDialog).2. Once opened, you can change the size of the dialog.3. The items in the dialog are: item 1: OK button, item 2: Cancel button, item 3: text list, item 4: prompt text.4. You can change the size of any item in the dialog except that you </span><span class="style2">SHOULD NOT </span><span class="style1">change their item number.5. If you change the size of the text list(item 3), you should make the height of that item to be the multiple value of 16 plus 2.eg. Top of item 3 is 26, you should set the bottom to be26 + (16 * 10) + 2 = 188to get 10 lines of text display (the height of Chicago font is 16 pixels).6. You </span><span class="style2">CANNOT</span><span class="style1"> change the id number of DLOG and DITL resources (both are 400). However, you </span><span class="style2">CAN</span><span class="style1"> change the id number of the XCMD resource(2000 originally).</span><span class="style2">The Author:</span><span class="style1">Jimmy SunAmerica Online: Jimmy SunThis is my first try to write a Hypercard XCMD. I have tested this XCMD in many Macs and it appears to work well. If you have any suggestion, please E-mail to me. ListDialog XCMD is free to use no matter what you want to do with it. However, I still retain all the right. If you like it, please send me a E-mail to tell me how you think about this XCMD. </span></text>
<text><span class="style6">istDialog XCMD 1.5</span><span class="style5">Jimmy Sun, 1991-1992America Online: Jimmy SunThis is my first try to write a Hypercard XCMD. I have tested this XCMD in many Macs and it appears to work well. If you have any suggestion, please E-mail to me. ListDialog XCMD is free to use no matter what you want to do with it. However, I still retain all the right. If you like it, please send me a E-mail to tell me how you think about this XCMD. ListDialog XCMD is written with THINK C with Hypercard 2.0 library. It is fully compatible with Hypercard 2.0 or above. However, I have not try it with Hypercard 1.2 so I do not know if it will work.</span><span class="style4"></span></text>